import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex)
// store刷新页面状态就消失了，使用时要考虑场景
const store = new Vuex.Store({
	// this.$store.state.属性名
	state: {
		// 当前项目id
		currentProjectId: "",
	},
	getters: {
		currentProjectId: (state, getters) => {
			console.log(state.currentProjectId, getters)
			return state.currentProjectId
		},
	},
	// 修改  this.$store.commit('mutation事件名',mapper参数)
	mutations: {
		/** 设置菜单 */
		setCurrentProjectId(state, currentProjectId) {
			console.log(state, currentProjectId)
			state.currentProjectId = currentProjectId
		},
	},
	actions: {},
})

export default store
